<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();

	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>发布老师信息</title>
<s:include value="../../backend/include.jsp"></s:include>
<link href="<%=basePath%>front/register/style/css/Announcement.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>front/register/style/css/AddressBook.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>front/register/css/Release_css.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>front/register/style/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<script src="<%=basePath%>front/register/style/SpryMenuBar.js" type="text/javascript"></script>
<script type="text/javascript" src="<%=basePath%>ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="<%=basePath%>js/address.js"></script>

<script type="text/javascript">	

	$(document).ready(function() {    
	    $("#refresh").click(function() {   
	        var rom = new Date();  
	        $("#randomCode").attr("src", "getRandomNumber?timestamp="+rom);    
	    });	
	    
	 	// 判断浏览器是否支持 placeholder
	    if(!placeholderSupport())
	    {   
	        $('[placeholder]').focus(function() {
	            var input = $(this);
	            if (input.val() == input.attr('placeholder')) {
	                input.val('');
	                input.removeClass('placeholder');
	            }
	        }).blur(function() {
	            var input = $(this);
	            if (input.val() == '' || input.val() == input.attr('placeholder')) {
	                input.addClass('placeholder');
	                input.val(input.attr('placeholder'));
	            }
	        }).blur();
	    };
	    
	});
	
	function placeholderSupport() 
	{
	    return 'placeholder' in document.createElement('input');
	}

	/**
	 * 保存
	 */
	function save() {
		var r_title = document.getElementsByName("teacher.t_title")[0].value;
		r_title = trimVal(r_title);
		if (r_title == "") {
			alert("标题是必填项");
			return;
		}
		if (r_title.length < 6) {
			alert("标题不能少于6位");
			return;
		}
		
		var t_name = document.getElementsByName("teacher.t_name")[0].value;
		t_name = trimVal(t_name);
		if (t_name == "") {
			alert("老师姓名是必填项");
			return;
		}
		
		var t_bir_y = document.getElementsByName("teacher.t_bir_y")[0].value;
		var t_bir_m = document.getElementsByName("teacher.t_bir_m")[0].value;
		if (t_bir_y == "0000" || t_bir_m == "00") {
			alert("请选择完整出生年月");
			return;
		}
		
		var honour = document.getElementsByName("teacher.honour")[0].value;
		if (honour == "0") {
			alert("请选择职务荣誉");
			return;
		}
		
		var area_s = document.getElementsByName("teacher.area_s")[0].value;
		if (area_s == "00") {
			alert("请选择地区");
			return;
		}
		
		var tel = document.getElementsByName("teacher.tel")[0].value;
		tel = trimVal(tel);
		if (tel == "") {
			alert("联系电话是必填项");
			return;
		}
		
		var tel_name = document.getElementsByName("teacher.tel_name")[0].value;
		tel_name = trimVal(tel_name);
		if (tel_name == "") {
			alert("联系人是必填项");
			return;
		}
		
		var detail = document.getElementsByName("teacher.detail")[0].value;
		detail = trimVal(detail);
		if (detail == "") {
			alert("详情是必填项");
			return;
		}

		//验证码检核
		var flag = false;
		$.ajax({
            type: "GET",
            url: "getRandomNumber!getRandomCode.action",
            data: "randomCode="+$("#randomCodeId").val(),
            async: false,
            dataType: "text",
            success: function(data)
            {
				if (data == "N") 
				{
					flag = true;
				}else 
				{
					flag = false;
				}
            }
        });

        if (flag) 
        {
			alert("验证码输入不正确");
			return;
        }
		
		window.location = "teacherAction!save.action";
		document.forms[0].submit();
	}
	
	//上傳照片實作
	function UploadPic() 
	{		
		var files = document.getElementsByName("picLink");
		var checkFlag = false;
		var strMsg = "";
		var filePathStr = "";
		
		for (var i = 0; i < files.length; i++) 
		{
			if (files[i].value == "") 
			{
				checkFlag = true;
				strMsg = "請選擇圖片！";
				break;
			}else 
			{
				var name = files[i].value.split('.');
                var extention = name[name.length - 1].toLowerCase();
                
         		//檢核是否為圖片
         		if (extention.toLowerCase() != "gif" && extention.toLowerCase() != "jpg" && extention.toLowerCase() != "jpeg" && extention.toLowerCase() != "png") 
         		{
    				checkFlag = true;
    				strMsg = "上传的文件类型错误，请选择jpg,jpeg,png和gif格式的图片!";
         			break;
         		}else 
         		{ 				
    				filePathStr += files[i].value + ",";
         		}
                
			}
		}
		
		if (checkFlag) 
		{
			alert(strMsg);
			return;
		}
		
		if (filePathStr.length > 0) 
		{
            filePathStr = filePathStr.substr(0, filePathStr.length - 1);
      	}		
		
		//Ajax 提交上傳		
		$.ajax({
            type: 'POST',
            url: 'uploadFile!uploadFile.action',
            data: 'uplFiles=' + filePathStr,
            async: false,
            dataType: "text",
            success: function (msg) 
            {
          		if (msg == "Y") 
          		{
          			alert("圖片上傳成功！");
          		}else 
          		{
          			alert("圖片上傳失敗！");	
          		}
            }
		});
			
	}
	
</script>
</head>

<body>
<div id="topWrapper">
	<div id="top">
    	<div id="top_font">
        	<p><a href="#" target="_blank">退出</a></p>
            <p><a href="#" target="_blank">建议</a></p>
            <p><a href="#" target="_blank">邀请好友</a></p>
            <p><a href="#" target="_blank">设置</a></p>
        	<p><a href="<%=basePath%>front/preSchool/Course.jsp" target="_blank">普度首页</a></p>
        </div>
    </div>
</div>

<div class="wide">
	<div class="w960 left">
        <div class="sumbit_left">
    	<div class="logo"><img src="<%=basePath%>front/register/style/imgs/logo.png"/></div>
          <div class="left_Theme boder_bt">
        	<strong>机构管理中心</strong>
            <p><small class="mt2"><img src="<%=basePath%>front/register/style/imgs/photo.png"/></small><em><a href="#" target="_blank">相&nbsp;&nbsp;&nbsp;册</a></em> <em class=" ml12"><a href="#" target="_blank">上传</a></em></p>
            <p><img src="<%=basePath%>front/register/style/imgs/Commendation.png"/><em><a href="#" target="_blank">证件、奖状</a></em>  <span class=" ml8"><a href="#" target="_blank">上传</a></span></p>
            <p><img src="<%=basePath%>front/register/style/imgs/news.png" /><em><a href="#" target="_blank">新&nbsp;&nbsp;&nbsp;闻</a></em>  <em class=" ml12"><a href="#" target="_blank">发表</a></em></p>
            <p><img src="<%=basePath%>front/register/style/imgs/announcment.png"/><em><a href="#" target="_blank">公&nbsp;&nbsp;&nbsp;告</a></em></p> 
       	  </div>
        	
        <div class="left_Theme boder_bt">
         	<p><img src="<%=basePath%>front/register/style/imgs/course.png" /><em><a href="#" target="_blank">课&nbsp;&nbsp;&nbsp;程</a></em>  <em class=" ml12"><a href="#" target="_blank">发布</a></em></p>
            <p><img src="<%=basePath%>front/register/style/imgs/teacher.png"/><em><a href="#" target="_blank">师者汇</a></em>  &nbsp;<em class=" ml12"><a href="#" target="_blank">发布</a></em></p>
      	</div>
      
      	<div class="left_Theme boder_bt">
            <p><img src="<%=basePath%>front/register/style/imgs/Groups.png" /><em><a href="#" target="_blank">群&nbsp;&nbsp;组</a></em> <em class=" ml12"><a href="#" target="_blank">创建</a></em></p>
            <p><img src="<%=basePath%>front/register/style/imgs/Microblogging.png"/><em><a href="#" target="_blank">微&nbsp;&nbsp;博</a></em></p>
            <p><img src="<%=basePath%>front/register/style/imgs/talk.png" /><em><a href="#" target="_blank">论&nbsp;&nbsp;坛</a></em></p>
   	  </div>
        
        <div class="left_Theme boder_bt">
            <p><img src="<%=basePath%>front/register/style/imgs/Vote.png"/><em><a href="#" target="_blank">投&nbsp;&nbsp;票</a></em></p>
            <p><img src="<%=basePath%>front/register/style/imgs/activity.png"/><em><a href="#" target="_blank">活&nbsp;&nbsp;动</a></em></p>
     	</div>
        <div class="left_Theme boder_bt">
            <p><img src="<%=basePath%>front/register/style/imgs/read.png" class="mt2"/><em><a href="#" target="_blank">读&nbsp;&nbsp;书</a></em></p>
            <p><img src="<%=basePath%>front/register/style/imgs/Gift.png"/><em><a href="#" target="_blank">礼&nbsp;&nbsp;品</a></em></p>
      	</div>
         <div class="left_Theme">
            <p><img src="<%=basePath%>front/register/style/imgs/share.png"/><em><a href="#" target="_blank">共享文件</a></em></p>
        </div>
        
        <div class="left_add"><a href="#" target="_blank"><img src="<%=basePath%>front/register/style/imgs/add.png"/></a>  <a href="#" target="_blank"><img src="<%=basePath%>front/register/style/imgs/manager.png"/></a></div>
        
  	</div>
              
    	<div class="release">
        
        	<div class="center_right_top">
            <div class="ml10 center_right_top_title"><a href="#" target="_blank">首&nbsp;&nbsp;&nbsp;页</a></div>

				 <ul id="MenuBar1" class="MenuBarHorizontal center_right_top_title">
                    <li><a class="MenuBarItemSubmenu fontsize" href="#">班级主页</a>
                      <ul>
                        <li><a href="#">项目 3.1</a>
                        </li>
                        <li><a href="#">项目 3.2</a></li>
                        <li><a href="#">项目 3.3</a></li>
                      </ul>
                    </li>
              	</ul>
              
              <div class="center_right_top_title"><a href="#" target="_blank">空间预览</a></div>
              <div class="center_right_top_title"><a href="#" target="_blank">交际管理</a></div>
              <div class="center_right_top_title"><a href="#" target="_blank">信息管理</a></div>

             <span class="search">
                  <em class="left"><img src="<%=basePath%>front/register/style/imgs/search_left.png"/></em>
                  <em class="search_middle"><input name="" type="text" placeholder="Search" /></em>
                  <em class="left"><a href="#" target="_blank" class="left"><img src="<%=basePath%>front/register/style/imgs/search_tb.png"/></a></em>
                  <em class="search_middle_right"><img src="<%=basePath%>front/register/style/imgs/search_right.png"/></em>
              </span>
            </div>
            
        	<div class="release_title">
            	<p class="release_title_right"><a href="<%=basePath%>front/register/Release.jsp" target="_blank" >发布课程信息</a></p>
                <p class="release_title_left"><a href="#" target="_blank" >发布老师信息</a></p>   
                <p class="release_title_right"><a href="<%=basePath%>front/register/Recruit_teachers.jsp" target="_blank" >招聘老师</a></p>
                <p class="release_title_right"><a href="<%=basePath%>front/register/Release_activity.jsp" target="_blank" >发布活动</a></p>
                <p class="release_title_right"><a href="<%=basePath%>front/register/Release_goodplace.jsp" target="_blank" >发布好去处</a></p>
            </div>
            
            <div class="release_font">
            	<span class="left ml10"><img src="<%=basePath%>front/register/images/power.png" width="11" height="17" /></span>
            	<p>1、培训公司、培训中心/学校等教育培训机构，请注册机构账号发布信息。</p>
                <p>2、正确选择机构和个人发布信息，否则将被删除。</p>
                <p>3、发布重复信息或灌水信息，信息将会被删除，严重者将锁定帐户。</p>
                <p>若点击发布按钮,即表示您已同意普度成长网服务条款    <em><a href="#" target="_blank">查看普度成长网服务条款</a></em></p>
            </div>
          
          <form action="front/teacherAction!save.action" method="post">
          <div class="release_form">
          		<div class="title"><a href="#" class="left mt10"><img src="<%=basePath%>front/register/images/red_tb.png"/></a><em class="left">标题：</em><input name="teacher.t_title" class="input" type="text" /> <span class="ml10">6-25个字，不许允许填写电话和特殊符号</span></div>
       			<div class="title mt10"><a href="#" class="left mt10"><img src="<%=basePath%>front/register/images/red_tb.png"/></a><em class="left">老师姓名：</em><input name="teacher.t_name" type="text" class="others ml10" /> 
                	<a href="#" class="left mt10 ml10"><img src="<%=basePath%>front/register/images/red_tb.png"/></a><em class="left">性别：</em><input type="radio" name="teacher.t_sex" value="0" id="RadioGroup1_0" checked="checked"/>
                          男
                          <input type="radio" name="teacher.t_sex" value="1" id="RadioGroup1_1"/>
                          女
                </div>
    			
                 <div class="title mt10"><a href="#" class="left mt10"><img src="<%=basePath%>front/register/images/red_tb.png"/></a><em class="left">出生年月：</em>
                		<select name="teacher.t_bir_y">
                      	<option value="0000">请选择</option>
                        <option value="1990">1990年</option>
                        <option value="1989">1989年</option>
                        <option value="1988">1988年</option>
                        <option value="1987">1987年</option>
                        <option value="1986">1986年</option>
                        <option value="1985">1985年</option>
                        <option value="1984">1984年</option>
                        <option value="1983">1983年</option>
                        <option value="1982">1982年</option>
                        <option value="1981">1981年</option>
                        <option value="1980">1980年</option>
                    </select>
              		
                    <select name="teacher.t_bir_m" class="ml10">
                    	<option value="00">请选择</option>
                		<option value="01">1月</option>
                        <option value="02">2月</option>
                        <option value="03">3月</option>
                        <option value="04">4月</option>
                        <option value="05">5月</option>
                        <option value="06">6月</option>
                        <option value="07">7月</option>
                        <option value="08">8月</option>
                        <option value="09">9月</option>
                        <option value="10">10月</option>
                        <option value="11">11月</option>
                        <option value="12">12月</option>
                    </select> 
       
                </div>
                
            	<div class="title mt10"><a href="#" class="left mt10"><img src="<%=basePath%>front/register/images/red_tb.png"/></a><em class="left">授课阶段：</em>
                    <select name="teacher.t_classStep">
                      	<option value="0">无忧在学前</option>
                        <option value="1">小学放飞梦想</option>
                        <option value="2">懵懂的初中</option>
                        <option value="3">高中冲刺吧</option>
                        <option value="4">中专、技校、职高</option>
                        <option value="5">我的大学</option>
                        <option value="6">工作实现自我</option>
                        <option value="7">退休又一个起点</option>
                    </select>
              		
            	</div>
                
                <div class="title mt10"><a href="#" class="left mt10"><img src="<%=basePath%>front/register/images/red_tb.png"/></a><em class="left">所授科目：</em>
                    <select name="">
                      	<option>请选择</option>
                        <option>婴幼儿教育</option>
                        <option>中小学教育</option>
                        <option>外语</option>
                        <option>学历</option>
                        <option>职业资格</option>
                        <option>职业技能</option>
                        <option>IT</option>
                        <option>设计</option>
                        <option>管理</option>
                        <option>其他</option>
                        <option>企业培训</option>
                    </select>
              		
                    <select name="" class="ml10">
                      	<option>请选择</option>
                        <option>钢琴</option>
                        <option>小提琴</option>
                        <option>电子琴</option>
                        <option>手风琴</option>
                        <option>古筝</option>
                        <option>二胡	</option>
                        <option>爵士鼓/架子鼓</option>
                         <option>萨克斯</option>
                        <option>长笛	</option>
                        <option>葫芦丝	</option>
                        <option>双簧管</option>
                        <option>其他</option>
                    </select>
                    
                    <select name="" class="ml10">
                      	<option>请选择</option>
                         <option>长笛	</option>
                        <option>葫芦丝	</option>
                        <option>双簧管</option>
                        <option>其他</option>
                    </select>
                   
                </div>
                
                <div class="title mt10"><a href="#" class="left mt10"><img src="<%=basePath%>front/register/images/red_tb.png"/></a><em class="left">授课方式：</em> 
                      <p  class="left">
                          <input type="radio" name="teacher.course_type" value="0" id="RadioGroup1_0" checked="checked"/>
                          家教
                          <input type="radio" name="teacher.course_type" value="1" id="RadioGroup1_1"/>
                          一对一
                          <input type="radio" name="teacher.course_type" value="2" id="RadioGroup1_2"/>
                          辅导班
                          <input type="radio" name="teacher.course_type" value="3" id="RadioGroup1_3"/>
                          网络教学
                      </p>
                </div>
                
            <div class="title mt10"><a href="#" class="left mt10"><img src="<%=basePath%>front/register/images/red_tb.png"/></a><em class="left">职务荣誉：</em> 
              <select name="teacher.honour">
                      	<option value="0">请选择</option>
                        <option value="1">婴幼儿教育</option>
                        <option value="2">中小学教育</option>
                        <option value="3">外语</option>
                        <option value="4">学历</option>
                        <option value="5">职业资格</option>
                        <option value="6">职业技能</option>
                        <option value="7">IT</option>
                        <option value="8">设计</option>
                        <option value="9">管理</option>
                        <option value="10">其他</option>
                        <option value="11">企业培训</option>
                </select>
              <a href="#" class="left ml10"><img src="<%=basePath%>front/register/images/add.png" width="19" height="18" /></a>
             </div>
                
            <div class="title mt10">
            	<a href="#" class="left mt10"><img src="<%=basePath%>front/register/images/red_tb.png"/></a><em class="left">地区：</em>
                    
       		  <em class="left pdl">武汉市 - </em>
                    
                    <select onchange="city1(this.value)" name="teacher.area_s">
								<option value="00">请选择</option>
								<option value="01">江岸</option>
								<option value="02">江汉</option>
								<option value="03">硚口</option>
					            <option value="04">汉阳</option>
					            <option value="05">武昌</option>
					            <option value="06">青山</option>
					            <option value="07">洪山</option>
					            <option value="08">东西湖</option>
					            <option value="09">汉南</option>
					            <option value="10">江夏 </option>
					            <option value="11">蔡甸</option>
					            <option value="12">黄陂</option>
					            <option value="13">新洲 </option>
							</select>
                    <em class="left pdl">区</em>

             <select id="city" name="teacher.area_e">
								<option value="00">请选择</option>
							</select>
                    
               <em class="left pdl">商圈</em>
                    
               <input name="teacher.address" type="text" class="place ml10" placeholder="请输入具体地址" id="请输入具体地址" />
                 
              </div>
             
             	
            <div class="title mt10">
            	<a href="#" class="left mt10"><img src="<%=basePath%>front/register/images/red_tb.png"/></a><em class="left">联系电话：</em><input name="teacher.tel" class="phone" type="text" /> 
                <em class="left ml10">联系人：</em><input name="teacher.tel_name" class="phone" type="text" /> 
            </div>
            
            <div class="title mt10">          
            </div>
            
            <div style="font-size: 16px">
            	<br/>
            	<br/><br/>
            	&nbsp;<img src="<%=basePath%>front/register/images/red_tb.png"/>详情：
                  <br/>
            	<br/>
                  <div style="">
                       <textarea  cols="80" id="editor1" name="teacher.detail" rows="10">
					      在此添加内容
					 </textarea>
					 <script type="text/javascript">
					    CKEDITOR.replace( 'editor1',
					     {
					      skin : 'kama',
					      language : 'zh-cn'
					     });
					 </script>
                 </div>
                 
                <div class=" bottom_img">
                	<div>上传照片:</div>
                     <div id="divPc" class="left">
                        
                   	    <tr name="pictr">
                        	<td>
                        		<p><em>照片:</em><input name="picLink" type="file" style="width: 250px" />
                        			<img alt="增加行" src="<%=basePath%>front/register/images/add.png" align="center" onclick="addPic()" />
                        		</p>
                        	</td>
                        </tr> 
                       
                    </div>                  
                    
                    <p><em class="bottom—input mt38" onclick="UploadPic();">上传照片</em></p>
                    <div class="bottom_prompt mt15"><font>严禁上传色情、暴力、恐怖、反动等违法照片，永葆普度网美好！</font></div>
                </div>
                
              <div class="code">
                    <p class="fontweight">验证码:</p>
                    <p><input name="" id="randomCodeId" type="text" placeholder="以下字符不区分大小写" /></p>
                    <p> <img src="getRandomNumber" width="90" height="25" alt="验证码图片" id="randomCode" /> <em class="ml10"><a id="refresh" class="color">看不清,换一张</a></em></p>
              </div>  
            
            <div class="sumbit">
            	<em><a href="#" onclick="save()">发布</a></em>
                <em><a href="#">预览</a></em>
            </div>          
            
            </div>
  
          </div>
            </form>
      </div>
     
    </div>
     <div class="clear"></div>
</div>

  <!--==底部==-->
<DIV class="clear"></DIV>
   <div class="foot">
   	  <div class=" foot_pudu">
        	 <a href="#" style=" float:left;">copright     2012All    版权所有：武汉普度教育科技有限公司</a>
             <a href="#"> 机构合作</a>
             <a href="#"> 广告</a>   
             <a href="#">友情链接</a> 
             <a href="#">意见反馈</a> 
             <a href="#">用户隐私 </a> 
        	 <a href="#">关于普度</a>
        </div>
    </div>
  
 <script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"style/SpryMenuBarDownHover.gif", imgRight:"style/SpryMenuBarRightHover.gif"});
   </script>   
</body>
</html>

<script type="text/javascript">
	
	//动态添加图片行
	function addPic() 
	{
		var e = window.event.srcElement;
		var tr = e.parentNode.parentNode;
		var strhtml = "<tr name='pictr'><td>";
		strhtml = strhtml + "<p><em>照片:</em><input name='picLink' type='file' style='width: 250px' />";
		strhtml = strhtml + "<img alt='刪除行' src='<%=basePath%>front/register/images/del.png' align='center' onclick='delRow(this)' /></p></td></tr>";
		$(tr).after(strhtml);
		
	}
	
	function delRow(k)
	{
		//刪除指定行
		//var e = window.event.srcElement;
		//var tr = e.parentNode.parentNode;
		//var i = $(tr).index();
		//divPc.deleteRow(i);  
		$(k).parent().remove();
	}
	
</script>
